import { Table, Radio, Divider } from "antd";
import React, { useState } from "react";
// import { Switch } from "antd";
export default function DataTable() {
  /*  const onChange = (checked) => {
    console.log(`switch to ${checked}`);
  }; */
  const rowSelection = {
    onChange: (selectedRowKeys, selectedRows) => {
      console.log(
        `selectedRowKeys: ${selectedRowKeys}`,
        "selectedRows: ",
        selectedRows
      );
    },
    getCheckboxProps: (record) => ({
      disabled: record.name === "Disabled User",
      // Column configuration not to be checked
      name: record.name,
    }),
  };
  const [selectionType, setSelectionType] = useState("checkbox");
  const columns = [
    {
      title: "序号",
      dataIndex: "NO",
      width: 150,
      align: "center",
    },
    {
      title: "门店名称",
      dataIndex: "name",
      width: 150,
      align: "center",
    },
    {
      title: "地址",
      dataIndex: "address",
      width: 150,
      align: "center",
    },
    {
      title: "销售额",
      dataIndex: "sales",
      align: "center",
    },
    {
      title: "配送额",
      dataIndex: "deliveryAmount",
      width: 150,
      align: "center",
    },
  ];
  const initData = () => {
    const data = [];
    for (let i = 0; i < 100; i++) {
      data.push({
        key: i,
        NO: `${i + 100}`,
        name: `人员名称`,
        sales: 322,
        deliveryAmount: 200,
        address: "云华路233号",
      });
    }
    return data;
  };
  const data = initData();
  return (
    <div className="dataList">
      <div>
        <span>数据列表</span>
        {/* <button className="btn">添加</button> */}
      </div>
      <div>
        {/*         <Radio.Group
          onChange={({ target: { value } }) => {
            setSelectionType(value);
          }}
          value={selectionType}
        >
          <Radio value="checkbox">Checkbox</Radio>
          <Radio value="radio">radio</Radio>
        </Radio.Group> */}

        {/* <Divider /> */}
      </div>
      <Table
        rowSelection={{
          type: selectionType,
          ...rowSelection,
        }}
        className="dataTable"
        columns={columns}
        dataSource={data}
        pagination={{
          // total: 100,
          pageSize: 10,
        }}
        /* scroll={{
          y: 240,
        }} */
      />
    </div>
  );
}
